<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
    <input type="text" v-model="keywords"><button @click="getGoodsList">搜索</button><br>
    <select v-model="priceRange">
        <option :value="2000">0-2000</option>
        <option :value="4000">2000-4000</option>
        <option :value="6000">4000-6000</option>
        <option :value="8000">6000-8000</option>
        <option :value="8001">8000以上</option>
    </select>
    <table>
        <thead>
            <tr>
                <th>商品名称</th>
                <th>分类</th>
               <th>品牌</th>
                <th>价格</th>
                <th>库存</th>
                <th>状态</th>
            </tr>
        </thead>
        <tbody>
        <tr v-for="goods in goodsList">
            <td>{{goods.name}}</td>
            <td>{{goods.category}}</td>
            <td>{{goods.brand}}</td>
            <td>{{goods.price}}</td>
            <td>{{goods.store}}</td>
            <td v-if="goods.status==0">未上架</td>
            <td v-if="goods.status==1">已经上架</td>
        </tr>
        <a href="/search/toAgg">查看品牌聚合报表</a>
        </tbody>


    </table>

</div>

</body>
<script src="/static/vue.min.js"></script>
<script src="/static/axios.min.js"></script>
<script>
    new Vue({
        el:"#app",
        data:{
            keywords:"",
            page:1,
            priceRange:7200,
            goodsList:[],
            total:0,
            totalPage:0
        },
        methods:{
            getGoodsList(){
                self=this;
                axios.get("/search/items?keywords="+this.keywords+"&page="+this.page+"&priceRange="+this.priceRange).then(function (res) {
                    console.log("res",res);
                   self.goodsList= res.data.content;
                   self.total=res.data.total;
                   self.totalPage=res.data.totalPage;
                })


            }

           /* addCarList(){
                axios.post("/book/carList?ids="+this.ids).then(function (res) {
                    console.log(res);
                })
            },
            showCars(){
                axios.get("/book/usercar").then(function (res) {
                    console.log(JSON.parse(res.data.content));
                    self.key=true;
                    self.carList=JSON.parse(res.data.content);
                    
                })
            },*/

        },
        mounted(){
            this.getGoodsList();

        }

    });
</script>

</html>